package com.baixun.pojo;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.util.Date;
import java.util.List;
import java.util.Objects;

@Data
public class User {

    @TableId(type = IdType.AUTO)
    private Integer id;
    private String username;
    private String loginName;
    private String password;
    private String phone;
    private String gender;
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    private Date loginTime;

    @Version
    @TableField(fill = FieldFill.INSERT)
    private Integer version;//版本号

    @TableField(fill = FieldFill.INSERT)
    private Byte status; //状态码

    private Role role;

    private List<Dep> deps;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(id, user.id) &&
                Objects.equals(username, user.username) &&
                Objects.equals(loginName, user.loginName) &&
                Objects.equals(password, user.password) &&
                Objects.equals(phone, user.phone) &&
                Objects.equals(gender, user.gender) &&
                Objects.equals(createTime, user.createTime) &&
                Objects.equals(loginTime, user.loginTime) &&
                Objects.equals(version, user.version) &&
                Objects.equals(status, user.status) &&
                Objects.equals(role, user.role);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, username, loginName, password, phone, gender, createTime, loginTime, version, status, role);
    }
}
